/**
 * 用类式调用方式
 * 知识点
 *      1、Function.prototype.addMethod需要返回this
 *         Methods类链式添加方法时要返回this
 */
Function.prototype.addMethod = function(name, fn) {
    this.prototype[name] = fn;
    return this;
};

var Methods = function() {};

Methods.addMethod('checkName', function() {
    console.log('checkName');
    return this;
}).addMethod('checkEmail', function() {
    console.log('checkEmail');
    return this;
});

var m = new Methods();
m.checkEmail();
